﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;

namespace ERP_RORZE.Product.PartHandling
{
    public partial class ctrlInspBusMisReturnDetail : DevExpress.XtraEditors.XtraUserControl
    {
        ClsPartHandlingDAO clsDAO = new ClsPartHandlingDAO();
        ClsDMInspBusTable clsobj = new ClsDMInspBusTable();
        DataTable dt;

        public ctrlInspBusMisReturnDetail()
        {
            InitializeComponent();
        }
        void Reload(object sender, EventArgs e)
        {
            dt = clsDAO.GetAllInspBusMisReturnDetail();
            gridControl1.DataSource = dt;
        }
        private void btnReload_Click(object sender, EventArgs e)
        {
            Reload(sender, e);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            clsobj.ID = int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString());
            clsDAO.DeleteInspBusMisReturnDetail(clsobj);
            Reload(sender, e);
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            frm_InspBusMisReturnInput frmAdd = new frm_InspBusMisReturnInput();
            frmAdd.Reload += new EventHandler(Reload);
            frmAdd.Show();
        }

        private void gridControl1_Load(object sender, EventArgs e)
        {
            Reload(sender, e);
        }

    }
}
